<?php

require_once('pub_inc.php');		//公共包含
$forum_id = 132;

$s_url = 'http://music.tudou.com/';
$html_h = file_get_contents_rand_ip($s_url);
if (preg_match_all('/<a href="http:\/\/www.tudou.com\/programs\/view\/[^\/]*\/*" title="[^"]*" target="new">/', $html_h, $m)) {
	foreach ($m[0] as $a) {
		if (preg_match('/<a href="http:\/\/www.tudou.com\/programs\/view\/([^\/]*)\/*" title="([^"]*)" target="new">/', $a, $m_1)) {

			//重复检查
			if (dt_query_one("SELECT id FROM forum_topic WHERE out_s_u = '".$m_1[1]."' AND forum_id = '$forum_id' LIMIT 1")) continue; 

			$title = $m_1[2];
			$content = '<p><iframe src="http://www.tudou.com/programs/view/html5embed.action?type=0&amp;code='.$m_1[1].'" allowtransparency="true" allowfullscreen="true" allowfullscreeninteractive="true" scrolling="no" border="0" frameborder="0" style="width:810px;height:480px;"></iframe></p><br>';

			do_topic_add_x($forum_id, $title, $content, null, $m_1[1], null, null);
			dt_query("UPDATE forum_topic SET orders = 0 WHERE out_s_u = '".$m_1[1]."' AND forum_id = '$forum_id'"); //关闭下单
		}
	}
} 
return true;
